import React from 'react';
import { BrowserRouter as Router, Route, Link } from 'react-router-dom';
import routes from './routes/routes';

export default class AppComponent extends React.Component {
    render() {
        return (
          <Router>
            <div>
              <nav>
                <ul>
                  <li><Link to="/" > Home Page</Link></li>
                  <li><Link to="/about" > About Page</Link></li>
                  <li><Link to="/contact" > Contact Page</Link></li>
                </ul>
              </nav>
              {
                routes.map( (route, i) => {
                  if (route.exact) {
                  return  <Route key={i} exact path={route.path} component={route.component} />
                  }else {
                  return  <Route key={i} path={route.path} component={route.component} />
                  }
                })
              }
            </div>
          </Router>
        )
    }
}
